package com.zzh.jetpackdemo.navigation

import android.os.Bundle
import android.util.Log
import androidx.appcompat.app.AppCompatActivity
import androidx.navigation.findNavController
import androidx.navigation.ui.AppBarConfiguration
import androidx.navigation.ui.NavigationUI
import androidx.navigation.ui.setupActionBarWithNavController
import androidx.navigation.ui.setupWithNavController
import com.google.android.material.bottomnavigation.BottomNavigationView
import com.zzh.jetpackdemo.R

class BottomNagActivity : AppCompatActivity() {



    override fun onCreate(savedInstanceState: Bundle?) {
        super.onCreate(savedInstanceState)
        var head = intent.getStringExtra("header")
        head?.let {
            Log.i("zhangzhihao", ">>>>>>$head")
        }
        setContentView(R.layout.activity_bottom_nag)
        val navView: BottomNavigationView = findViewById(R.id.nav_view)

        val navController = findNavController(R.id.nav_host_fragment)
        // Passing each menu ID as a set of Ids because each
        // menu should be considered as top level destinations.

        val appBarConfiguration =AppBarConfiguration
            .Builder(R.id.navigation_home, R.id.navigation_dashboard, R.id.navigation_notifications)
            .setOpenableLayout(null)
            .setFallbackOnNavigateUpListener { true }
            .build()

        setupActionBarWithNavController( navController, appBarConfiguration)

        navView.setupWithNavController(navController)

    }
}